PLACES_SIDEBAR_COLUMN_TOOLTIP,
PLACES_SIDEBAR_COLUMN_SECTION_TYPE,
PLACES_SIDEBAR_COLUMN_HEADING_TEXT,
+ PLACES_SIDEBAR_COLUMN_SENSITIVE,
PLACES_SIDEBAR_COLUMN_COUNT
};
PLACES_SIDEBAR_COLUMN_BOOKMARK, place_type != PLACES_BOOKMARK,
PLACES_SIDEBAR_COLUMN_TOOLTIP, tooltip_escaped,
PLACES_SIDEBAR_COLUMN_SECTION_TYPE, section_type,
+ PLACES_SIDEBAR_COLUMN_SENSITIVE, TRUE,
-1);
g_free (tooltip_escaped);
return (pos == GTK_TREE_VIEW_DROP_BEFORE || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
}
+static void
+update_possible_drop_targets (GtkPlacesSidebar *sidebar,
+ gboolean dragging)
+{
+ GtkTreeIter iter;
+ PlaceType place_type;
+ gchar *uri;
+ gboolean sensitive;
+
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (sidebar->store), &iter))
+ return;
+
+ do
+ {
+ sensitive = TRUE;
+ gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store), &iter,
+ PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type,
+ PLACES_SIDEBAR_COLUMN_URI, &uri,
+ -1);
+ if (dragging)
+ {
+ switch (place_type)
+ {
+ case PLACES_CONNECT_TO_SERVER:
+ sensitive = FALSE;
+ break;
+ case PLACES_BUILT_IN:
+ if (g_strcmp0 (uri, "recent:///") == 0)
+ sensitive = FALSE;
+
+ break;
+ default:
+ break;
+ }
+ }
+
+ gtk_list_store_set (sidebar->store, &iter,
+ PLACES_SIDEBAR_COLUMN_SENSITIVE, sensitive,
+ -1);
+ g_free (uri);
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (sidebar->store), &iter));
+}
+
/* Computes the appropriate row and position for dropping */
static gboolean
compute_drop_position (GtkTreeView *tree_view,
show_new_bookmark_row (sidebar, path);
else
gtk_tree_view_set_drag_dest_row (sidebar->tree_view, path, pos);
+
+ update_possible_drop_targets (sidebar, TRUE);
}
static void
stop_drop_feedback (GtkPlacesSidebar *sidebar)
{
gtk_tree_view_set_drag_dest_row (sidebar->tree_view, NULL, 0);
+ update_possible_drop_targets (sidebar, FALSE);
}
static gboolean
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_attributes (col, cell,
"gicon", PLACES_SIDEBAR_COLUMN_GICON,
+ "sensitive", PLACES_SIDEBAR_COLUMN_SENSITIVE,
NULL);
gtk_tree_view_column_set_cell_data_func (col, cell,
icon_cell_renderer_func,
"text", PLACES_SIDEBAR_COLUMN_NAME,
"visible", PLACES_SIDEBAR_COLUMN_NO_EJECT,
"editable-set", PLACES_SIDEBAR_COLUMN_BOOKMARK,
+ "sensitive", PLACES_SIDEBAR_COLUMN_SENSITIVE,
NULL);
g_object_set (cell,
"ellipsize", PANGO_ELLIPSIZE_END,
G_TYPE_BOOLEAN,
G_TYPE_STRING,
G_TYPE_INT,
- G_TYPE_STRING
+ G_TYPE_STRING,
+ G_TYPE_BOOLEAN
};
model = g_object_new (shortcuts_model_get_type (), NULL);
if (visible)
{
show_new_bookmark_row (sidebar, NULL);
+ update_possible_drop_targets (sidebar, TRUE);
sidebar->drop_state = DROP_STATE_NEW_BOOKMARK_ARMED_PERMANENT;
}
else